//	Company:	HTHK
//	NAME:	    YearOptions.java
//	TITLE:	    The option of Year in Time Sheet System
//	FUNCTION:	The option of Year
//	BY:	        Kodak Xu
//	DATE:	    09/12/2003
// --------------------------------------------------------------
// MODIFICATION HISTORY
// --------------------------------------------------------------
//	CR Log #:  99999  BY:  XXXX   DATE:  dd/mm/yyyy
//	ERROR:	XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//	FIX:	XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// --------------------------------------------------------------

package tss.options;

import tss.common.Options2;
import java.util.ArrayList;
import java.sql.Connection;
import java.util.Calendar;

public class YearOptions
  extends Options2
{ 
  public YearOptions() {
      this.load();
  }

  @Override
protected ArrayList createOptions(Connection con)
    throws Exception
  {
	  Calendar now = Calendar.getInstance();
	  ArrayList options = new ArrayList();
	  //the year range from 3 years ago to 7 years later
	  int year = now.get(Calendar.YEAR)-3;
	  for (int i=0; i<=10; i++)
      {
          Options2.Option option = new Options2.Option(String.valueOf(i+year),String.valueOf(i+year));
          options.add(i,option);
      }
      return options;
  }
}